package main

import "fmt"

/*func main() {
	var a any = 1
	fmt.Printf("%T\n", a)

	b := a.(int)
	fmt.Printf("%d,%T\n", b, b)

	b, ok := a.(int)
	if !ok {
		fmt.Println("failed")
	} else {
		fmt.Printf("%d,%T\n", b, b)
	}

}
*/
//断言
/*
func main() {
	var a any = 2
	fmt.Printf("%d,%T\n", a, a)
	b := a.(int)
	fmt.Printf("%d,%T\n", b, b)

	b, ok := a.(int)
	if !ok {
		fmt.Println("failed")
	} else {
		fmt.Println("成功", b+1)
	}
}
*/

func main() {
	var a any = "啊大傻吊"
	fmt.Printf("%T\n", a)

	b := a.(string)
	fmt.Printf("%T\n", b)

	b, ok := a.(string)
	if !ok {
		fmt.Println("fialeqe")
	} else {
		fmt.Printf("%d,%T\n", b, b)
	}
}
